import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class TelefonoGUI extends JFrame{

	private static final long serialVersionUID = 1L;
	public JPanel pannello1,pannello2,pannello3,pannello4,pannello5,pannello6,pannello7;
	public JButton n1,n2,n3,n4,n5,n6,n7,n8,n9,n0,ns,nc,n11,n21,n31,n41,n51,n61,n71,n81,n91,n01,ns1,nc1;
	public JTextField numero,codice;
	public JTextArea messaggio,messaggio2;
	public JLabel label,label2;
	public JButton conferma,reset,back,leggi,lascia;
	public ButtonGroup scelta,scelta_2;
	public JRadioButton scelta_lascia,scelta_leggi,coda_letti,coda_nuovi;
	public JFrame frame2,frame3,frame4;
	public Connessione connect ;
	public String numeroTel;


	public TelefonoGUI(){

		pannello1 	= new JPanel();
		pannello2 	= new JPanel();
		pannello3 	= new JPanel();
		pannello4 	= new JPanel();
		pannello5 	= new JPanel();
		pannello6 	= new JPanel();
		pannello7 	= new JPanel();

		frame2	   = new JFrame();
		frame3	   = new JFrame();
		frame4	   = new JFrame();

		numero     = new JTextField("");
		codice     = new JTextField("");

		label2     = new JLabel(" ");
		label      = new JLabel(" ");


		scelta 			= new ButtonGroup();
		scelta_lascia 	= new JRadioButton("lascia messaggio");
		scelta_leggi 	= new JRadioButton("leggi messaggio");	
		scelta_2		= new ButtonGroup();
		coda_letti	 	= new JRadioButton("messaggi gia' letti");
		coda_nuovi 		= new JRadioButton("messaggi nuovi");		

		conferma   	 	= new JButton("Call");
		reset   		= new JButton("Back");
		back 			= new JButton("reset");
		lascia 			= new JButton("OK");
		leggi 			= new JButton("OK");
		n1 				= new JButton("1");
		n2  	    	= new JButton("2");
		n3   			= new JButton("3");
		n4   			= new JButton("4");
		n5   			= new JButton("5");
		n6   			= new JButton("6");
		n7   			= new JButton("7");
		n8   			= new JButton("8");
		n9   			= new JButton("9");
		n0   			= new JButton("0");
		ns   			= new JButton("*");
		nc		   		= new JButton("#");
		n11 			= new JButton("1");
		n21  	    	= new JButton("2");
		n31   			= new JButton("3");
		n41   			= new JButton("4");
		n51   			= new JButton("5");
		n61   			= new JButton("6");
		n71   			= new JButton("7");
		n81   			= new JButton("8");
		n91   			= new JButton("9");
		n01   			= new JButton("0");
		ns1   			= new JButton("*");
		nc1		   		= new JButton("#");

		this.setTitle("telefono");
		this.setSize(300, 300);	
		this.setResizable(false);
		this.setLocationRelativeTo(getRootPane());
		this.setLayout(new BorderLayout());
		this.setVisible(true);

		frame2.setVisible(false);
		frame3.setVisible(false);

		pannello1.setLayout(new FlowLayout());
		pannello2.setLayout(new GridLayout(4,3));
		pannello3.setLayout(new FlowLayout());
		pannello3.setPreferredSize(new Dimension(150,200));
		pannello4.setLayout(new GridLayout(1,2));

		this.add(pannello1,BorderLayout.NORTH);
		pannello1.setLayout(new GridLayout(1,2));
		numero.setFont(new Font("monospaced", Font.BOLD, 30));
		numero.setBackground(Color.darkGray);
		numero.setForeground(Color.white);
		pannello1.add(numero);

		this.add(pannello2,BorderLayout.CENTER);

		pannello2.add(n1);
		pannello2.add(n2);
		pannello2.add(n3);
		pannello2.add(n4);
		pannello2.add(n5);
		pannello2.add(n6);
		pannello2.add(n7);
		pannello2.add(n8);
		pannello2.add(n9);
		pannello2.add(ns);
		pannello2.add(n0);
		pannello2.add(nc);

		this.add(pannello3,BorderLayout.WEST);
		scelta.add(scelta_lascia);
		scelta.add(scelta_leggi);
		pannello3.add(label2);
		pannello3.add(label2);
		pannello3.add(label2);
		pannello3.add(label2);
		pannello3.add(scelta_lascia);
		pannello3.add(scelta_leggi);

		this.add(pannello4,BorderLayout.SOUTH);	
		pannello4.add(conferma);
		pannello4.add(back);
	
}
}
